﻿<phone:PhoneApplicationPage 
    x:Class="WPtrakt.MyMovies"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:cc="clr-namespace:Clarity.Phone.Controls;assembly=Clarity.Phone"
    xmlns:local="clr-namespace:WPtrakt"
    SupportedOrientations="PortraitOrLandscape"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True" BackKeyPress="PhoneApplicationPage_BackKeyPress" Loaded="PhoneApplicationPage_Loaded" OrientationChanged="PhoneApplicationPage_OrientationChanged">
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="60"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel x:Name="TitlePanel" Grid.Row="0">
            <StackPanel Orientation="Horizontal">
                <Image Source="Images/fulllogo.png" Height="40" Margin="10 0 5 0"/>
                <TextBlock CacheMode="BitmapCache"  Text="trakt"  FontSize="33" FontFamily="Segoe WP SemiBold"/>
            </StackPanel>
            <Border Margin="0 2"  Height="3" Background="{StaticResource PhoneAccentBrush}" CacheMode="BitmapCache"/>
            <ProgressBar VerticalAlignment="Top" Visibility="{Binding LoadingStatus}" x:Name="progressBar" IsIndeterminate="True" Margin="0 5" />
        </StackPanel>
        <controls:Panorama SelectionChanged="Panorama_SelectionChanged" Name="MyMoviesPanorama" Grid.Row="1" >
            <controls:PanoramaItem Orientation="Horizontal" Margin="0 -40">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="55" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <toolkit:ListPicker Grid.Row="0"  ExpansionMode="FullscreenOnly" Margin="0 -30" Height="50" Foreground="{StaticResource PhoneAccentBrush}" BorderBrush="{StaticResource PhoneBackgroundBrush}"  Background="{StaticResource PhoneBackgroundBrush}" Name="Filter" SelectionChanged="Filter_SelectionChanged">
                        <sys:String>All</sys:String>
                        <sys:String>Watchlist</sys:String>
                        <toolkit:ListPicker.FullModeItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal" Margin="16 21 0 20">
                                    <TextBlock Text="{Binding}"
                                       Margin="0 0 0 0"
                                       FontSize="43" 
                                       FontFamily="{StaticResource PhoneFontFamilyLight}"/>
                                </StackPanel>
                            </DataTemplate>
                        </toolkit:ListPicker.FullModeItemTemplate>
                    </toolkit:ListPicker>
                    <cc:QuickJumpGrid Grid.Row="1" DataSource="{Binding MovieItems}"
                                    IsAlphaNumeric="True"
                                   Margin="12 0 0 45" Width="Auto"  MaxWidth="880" Name="ListMyMovies">
                        <cc:QuickJumpGrid.QuickJumpGridSelector>
                            <local:MovieNameSelector />
                        </cc:QuickJumpGrid.QuickJumpGridSelector>
                        <cc:QuickJumpGrid.ItemTemplate>
                            <DataTemplate>
                                <Canvas Margin="0,6,0,6" Height="103" Tap="Canvas_Tap">
                                    <StackPanel VerticalAlignment="Top" Orientation="Vertical">
                                        <TextBlock  VerticalAlignment="Top" Text="{Binding Name}" Style="{StaticResource PhoneTextLargeStyle}" />
                                        <TextBlock Margin="14 0" VerticalAlignment="Top" Text="{Binding GenreString}" Style="{StaticResource PhoneTextSubtleStyle}" />
                                        <TextBlock Margin="14 0" VerticalAlignment="Top" Text="{Binding SubItemText}" Style="{StaticResource PhoneTextSubtleStyle}" />
                                    </StackPanel>
                                </Canvas>
                            </DataTemplate>
                        </cc:QuickJumpGrid.ItemTemplate>
                    </cc:QuickJumpGrid>
                </Grid>
            </controls:PanoramaItem>
            <controls:PanoramaItem Orientation="Horizontal" Name="SuggestionsPanoramaItem" Margin="0 -25">
                <StackPanel>
                    <TextBlock Grid.Row="0" Text="Suggestions" FontSize="40" />
                    <ListBox Margin="0 5" ItemsSource="{Binding SuggestItems}" Width="700" Name="ListSuggestions" ScrollViewer.VerticalScrollBarVisibility="Disabled">
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <toolkit:WrapPanel ItemWidth="170" ItemHeight="250" Name="WrapPanelTrending"/>
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                        <ListBox.ItemTemplate >
                            <DataTemplate>
                                <Grid>
                                    <Image Source="{Binding MediumImage}" Width="160" Height="250" Tap="Image_Tap" VerticalAlignment="Top" />
                                    <Image Visibility="{Binding WatchlistVisibility}"  VerticalAlignment="Top" HorizontalAlignment="Left" Width="25" Height="40"  Grid.Column="0" Source="Images/watchlist.png"/>
                                    <Image Visibility="{Binding SeenVisibility}"  VerticalAlignment="Top" HorizontalAlignment="Right" Width="60" Height="60"  Grid.Column="0" Source="Images/episode-watched.png"/>
                                    <toolkit:ContextMenuService.ContextMenu>
                                        <toolkit:ContextMenu>
                                            <toolkit:MenuItem Header="Check In" Name="CheckinEpisode" Click="CheckinMovie_Click" />
                                            <toolkit:MenuItem Header="Mark as seen" Name="SeenEpisode" Click="SeenMovie_Click" />
                                            <toolkit:MenuItem Header="Add to watchlist" Name="WatchlistEpisode" Click="WatchlistMovie_Click" />
                                        </toolkit:ContextMenu>
                                    </toolkit:ContextMenuService.ContextMenu>
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
               </StackPanel>
            </controls:PanoramaItem>
        </controls:Panorama>
    </Grid>
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Minimized">
             <shell:ApplicationBarIconButton IconUri="Images/appbar.refresh.rest.png" Text="Refresh" Click="ApplicationBarIconButton_Click" />
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>